<template>
  <div id="header">
    <van-nav-bar
      :title="this.$store.state.top_title"
      left-arrow
      @click-left="onClickLeft"
    />
  </div>
</template>

<script>
// @ is an alias to /src
import IngotCookie from '@/utils/cookie.js';
import { mapGetters, mapActions } from 'vuex'
import { NavBar } from 'vant';
import { enums } from '@/core/config';

export default {
  name: 'dq-header',
  components: {
    NavBar
  },
  // props: {
  //   title: {
  //     type: String,
  //     default: ''
  //   },
  //   left: {
  //     type: String,
  //     default: ''
  //   },
  //   right: {
  //     type: String,
  //     default: ''
  //   }
  // },
  data() {
    return {
      // title: ''
    }
  },
  computed:{
    ...mapGetters([
      'set_top_title'
    ]),
  },
  mounted(){
    // this.$store.commit('set_top_title',this.title);
  },
  methods: {
    ...mapActions([
      'FedLogOut',
      'remove_all'
    ]),
    onClickLeft() {
      if(this.$store.state.currentPage==2){
        IngotCookie.remove({key:enums.PAGE.VIN});
      }
      this.$store.commit('set_page_index', IngotCookie.get('current')-1)

    },
    exit() {
      // this.remove_all()
      this.FedLogOut().then(res => {
        // this.$router.push({ path: '/login' })
        console.log("exit ===> ",res);
      }).catch(() => {})
    }
  }
}
</script>

<style scoped>

</style>